<template>
  <div class="">
    <el-form :inline="true">
      <div style="display: flex; justify-content: space-between;">
        <div>
          <el-form-item>
            <el-input v-model="key" clearable placeholder="请输入查询内容" style="width: 200px;" />
          </el-form-item>
          <!-- <el-form-item label="店铺：">
            <el-select v-model="selleruserid" filterable remote placeholder="请选择" :remote-method="getShopList"
              :loading="shopLoading">
              <el-option :key="-1" label="全部" :value="0"></el-option>
              <el-option v-for="item in shopList" :key="item.userid" :label="item.shopname" :value="item.userid">
              </el-option>
            </el-select>
          </el-form-item> -->
          <el-form-item label="分类：">
            <el-cascader v-model="tid"
              :props="{ checkStrictly: true, value: 'id', label: 'tname', emitPath: false, expandTrigger: 'hover' }"
              :options="tidList" clearable />
          </el-form-item>
          <el-form-item label="分区：">
            <el-select v-model="wards" placeholder="请选择">
              <el-option :key="0" label="全部" :value="0" />
              <el-option v-for="item in Object.keys(wardsList)" :label="wardsList[item]" :value="item" />
            </el-select>
          </el-form-item>
          <el-form-item label="状态：">
            <el-select v-model="state" placeholder="请选择">
              <el-option v-for="item in Object.keys(stateList)" :label="stateList[item]" :value="item" />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="init">查询</el-button>
          </el-form-item>
        </div>
        <div>
          <el-form-item>
            <el-button type="primary" @click="onVisible(1)">新增商品</el-button>
          </el-form-item>
        </div>
      </div>
    </el-form>

    <!-- 列表 -->
    <el-table v-loading="listLoading" :data="tableData" :expand-row-keys="expandKeys" :row-key="getRowKey" border
      style="width: 100%" :max-height="screenHeight - 280">
      <!-- 展开项 -->
      <el-table-column type="expand">
        <template slot-scope="{ row }">
          <div style="width: 80%; padding: 20px 0 20px 50px">
            <el-descriptions class="margin-top" :column="6" size="small">

              <el-descriptions-item label="是否首页显示">{{
      row.istop | yesNo
    }}</el-descriptions-item>
              <el-descriptions-item label="是否新品">{{
        row.isnew | yesNo
      }}</el-descriptions-item>
              <el-descriptions-item label="是否热卖">{{
        row.ishot | yesNo
      }}</el-descriptions-item>
              <el-descriptions-item label="是否包含属性">{{
        row.containattr | yesNo
      }}</el-descriptions-item>
              <el-descriptions-item label="多商品运费是否叠加">{{
        row.dualyf | yesNo
      }}</el-descriptions-item>

            </el-descriptions>
          </div>
        </template>
      </el-table-column>

      <!-- 商品列信息 -->
      <el-table-column prop="id" label="ID" width="60" align="center" />
      <el-table-column prop="bannerpicurl" label="产品图" width="80px" align="center">
        <template slot-scope="{row}">
          <el-image style="width: 50px; height: 50px" :src="row.bannerpicurl.split(',')[0]"
            :preview-src-list="row.bannerpicurl.split(',')" />
        </template>
      </el-table-column>
      <el-table-column prop="goodsname" show-overflow-tooltip label="商品名称" align="center" />
      <el-table-column label="所属分类" width="150px" align="center">
        <template slot-scope="scope">
          <el-cascader v-model="scope.row.tidArr" width="400px" placeholder="未设置分类"
            :props="{ value: 'id', label: 'tname', checkStrictly: true }" disabled :options="tidList" />
        </template>
      </el-table-column>
      <el-table-column prop="wards" label="所属分区" align="center" width="100px">
        <template slot-scope="{row}">
          <el-tag>{{ wardsList[row.wards] }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="price" label="单价" align="center" width="100px">
        <template slot-scope="scope">
          <span>￥{{ scope.row.price }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="costprice" label="成本价" align="center" width="80px">
        <template slot-scope="scope">
          <span>￥{{ scope.row.costprice }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="feecoinid" label="消耗积分" align="center">
        <template slot-scope="{row}">
          <div v-if="row.feecoinid == item.coinid" v-for="item in coinList">币种：{{ item.coinname }}</div>
          <div>数量：{{ row.feejf }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="ljfcount" label="返利积分" align="center" />
      <el-table-column prop="discount" label="获得贡献值" align="center" />
      <el-table-column prop="card1Count" label="获得体验券数量" align="center" />
      <el-table-column prop="card2Count" label="获得次卡数量" align="center" />
      <el-table-column prop="yf" label="运费" align="center" width="80px">
        <template slot-scope="scope">
          <span>￥{{ scope.row.yf }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="stock" label="库存" align="center" width="80px" />
      <!-- <el-table-column prop="containattr" label="是否包含属性" align="center" width="80px">
        <template slot-scope="{row}">
          <el-tag v-if="row.containattr == 0" type="danger">否</el-tag>
          <el-tag v-else>包含</el-tag>
        </template>
      </el-table-column> -->
      <el-table-column prop="state" label="状态" align="center" width="80px">
        <template slot-scope="scope">
          <el-switch v-model="scope.row.state" :active-value="1" :inactive-value="2"
            @change="(val) => { return SetValid(val, scope.row.id) }" />
        </template>
      </el-table-column>
      <el-table-column label="操作" width="280px" align="center">
        <template slot-scope="scope">
          <el-button size="mini" type="primary" @click="onVisible(2, scope.row)">编辑</el-button>
          <!-- <el-button size="mini" type="success" style="margin-top: 10px"
            @click="$router.push({ name: 'GoodsAttribute', query: { gid: scope.row.id, price: scope.row.price } })">商品属性</el-button> -->
          <!-- <el-button size="mini" type="success" style="margin-top: 10px"
            @click="$router.push({ name: 'GoodsComment', query: { gid: scope.row.id, goodsname: scope.row.goodsname } })">商品评论</el-button> -->
        </template>
      </el-table-column>
    </el-table>
    <div class="block " style="padding-top: 20px;">
      <el-pagination background :current-page="PageIndex" :page-sizes="[10, 20, 30, 40]" :page-size="PageSize"
        layout="total, sizes, prev, pager, next, jumper" :total="totalCount" @size-change="idx => { PageSize = idx }"
        @current-change="idx => { PageIndex = idx }" />
    </div>

    <!-- 新增商品、编辑商品 -->
    <el-dialog width="1200px" :close-on-click-modal="false" :title="visibleType == 1 ? '新增商品' : '编辑商品'"
      :visible.sync="dialogVisible" @open="openDialog('forms')" @closed="handleClose">
      <el-form id="forms" ref="forms" :rules="rulesModel" :model="form" label-width="130px"
        style="max-height: 600px;overflow-y: scroll;">
        <div>
          <el-form-item label="商品图片" prop="bannerpicurl">
            <UploadImageList :existList="picurlsArr" @uploadSuccess="uploadSuccess" @delExist="delExistChange"
              :isDisplay="dialogVisible" />
          </el-form-item>
        </div>
        <el-form-item label="商品名称" prop="goodsname" style="width: 1000px;">
          <el-input v-model="form.goodsname" type="text" placeholder="请输入商品名称" />
        </el-form-item>
        <el-form-item label="商品简述" style="width: 1000px;">
          <el-input v-model="form.sketch" type="textarea" placeholder="请输入商品简述" />
        </el-form-item>
        <div style="display: flex;">
          <el-form-item label="选择分类">
            <el-cascader v-model="tidArr" width="400px" placeholder="选择分类" :props="cascaderProps" :options="tidList"
              clearable />
          </el-form-item>
          <el-form-item label="所属分区">
            <el-select v-model="form.wards" placeholder="请选择">
              <el-option v-for="item in Object.keys(wardsList)" :label="wardsList[item]" :value="Number(item)" />
            </el-select>
          </el-form-item>
          <el-form-item label="用户等级" prop="uLevel" v-if="form.wards == 4">
            <el-select v-model="form.uLevel" placeholder="请选择">
              <el-option v-for="item in Object.keys(uLevel)" :label="uLevel[item]" :value="Number(item)" />
            </el-select>
          </el-form-item>
        </div>
        <div style="display: flex;">
          <el-form-item label="消耗币种">
            <el-select v-model="form.feecoinid" placeholder="请选择币种" clearable>
              <el-option v-for="item in coinList" :disabled="item.coinid != 2" :label="item.coinname"
                :value="item.coinid" />
            </el-select>
          </el-form-item>
          <el-form-item label="消耗数量">
            <el-input v-model="form.feejf" type="number" placeholder="请输入消耗数量" />
          </el-form-item>
        </div>
        <el-form-item label="发货地">
          <el-cascader v-model="form.startaddress" :options="proCityList" :props="areaprops" @change="handleChange"
            style="width: 400px;"></el-cascader>
        </el-form-item>
        <div style="display: flex;">
          <el-form-item label="显示">
            <el-checkbox v-model="form.istop" :true-label="1">首页显示</el-checkbox>
            <el-checkbox v-model="form.isnew" true-label="1">新品</el-checkbox>
            <el-checkbox v-model="form.ishot" true-label="1">热卖</el-checkbox>
          </el-form-item>
        </div>
        <div style="display: flex;">
          <el-form-item label="零售价" prop="price">
            <el-input v-model="form.price" placeholder="请输入商品零售价" @input="priceChange" />
          </el-form-item>
          <el-form-item label="成本价">
            <el-input v-model="form.costprice" placeholder="请输入商品成本价" @input="priceChange" />
          </el-form-item>
        </div>
        <div style="display: flex;">
          <el-form-item label="返利积分" prop="ljfcount" label-width="200" style="width: 400px;">
            <div class="flex">
              <el-input v-model="form.ljfcount" :disabled="this.userInfo.roid == 4" placeholder="请输入返利积分" />
            </div>
          </el-form-item>
          <el-form-item label="运费">
            <el-input v-model="form.yf" type="number" :rows="2" placeholder="请输入运费" />
          </el-form-item>
        </div>
        <div style="display: flex;">
          <el-form-item label="获得体验券数量" prop="card1Count">
            <el-input v-model.number="form.card1Count" :rows="2" placeholder="请输入获得体验券数量" />
          </el-form-item>
          <el-form-item label="获得次卡数量" prop="card2Count">
            <el-input v-model.number="form.card2Count" :rows="2" placeholder="请输入获得次卡数量" />
          </el-form-item>
        </div>
        <el-form-item label="获得贡献值" prop="discount" style="width: 1000px;">
          <el-input v-model.number="form.discount" :rows="2" placeholder="请输入获得贡献值" />
        </el-form-item>
        <div style="display: flex;">
          <el-form-item label="库存" prop="stock">
            <el-input v-model.number="form.stock" :rows="2" placeholder="请输入商品库存" />
          </el-form-item>
          <el-form-item label="排序">
            <el-input v-model.number="form.sort" :rows="2" placeholder="排序" />
          </el-form-item>
        </div>
        <div style="display: flex;">
          <div style="margin-left: 20px;">
            <el-form-item label="多商品运费是否叠加" label-width="200" style="width: 200px;">
              <el-switch v-model="form.dualyf" active-value="1" inactive-value="0" />
            </el-form-item>
          </div>
        </div>
        <el-form-item label="发货/不发货" prop="sendTotal">
          <el-switch v-model="form.sendTotal" :active-value="1" :inactive-value="0" />
        </el-form-item>
        <el-form-item label="上架/下架" prop="state">
          <el-switch v-model="form.state" :active-value="1" :inactive-value="2" />
        </el-form-item>
        <div>
          <el-form-item label="商品描述" prop="content" style="width: 1000px;">
            <editor v-model="form.content" />
          </el-form-item>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button :loading="buttonLoading" type="primary" @click="onEdit(1)">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 设置运费模板弹窗 -->
    <DigSetExtaddr v-if="modalStatus == 1" />
  </div>
</template>

<script>
import { getToken } from "@/utils/auth";
import editor from "../../../components/Editor/index.vue";
import { proCityList } from "@/utils/area";
import {
  getgoodstypepage,
  getgoodspage,
  GoodsEdti,
  DeleteShopgoods,
  GoodsFirst,
  SetState,
  MallShopPage
} from "@/api/goods.js";
import store from '@/store'
import { forEach } from "jszip/lib/object";
import { push } from "../../../../mock/article";
import { GetEnum, extaddrItem, coinlist } from "@/api/ctrls.js";
import { getInfo } from '@/api/sys'
import DigSetExtaddr from './components/digSetExtaddrItem.vue'
export default {
  name: "Name",
  components: { editor, DigSetExtaddr },
  data() {
    return {

      key: "",
      wards: 0, // 所属分区
      selleruserid: 0,
      expandKeys: [],
      state: '0',
      tid: "",
      istop: "",
      tidList: [],

      coinList: [], // 币种列表
      wardsList: {}, // 商品分区列表
      stateList: {}, // 商品状态列表
      uLevel:{},


      listLoading: false,
      tableData: [],
      totalCount: 0,
      PageIndex: 1,
      PageSize: 10,


      dialogVisible: false,
      buttonLoading: false,
      visibleType: "", // 操作类型  1--新增商品   2--编辑商品    3--商品属性
      form: {},
      rulesModel: {
        goodsname: [
          { required: true, message: "请输入商品名称", trigger: "blur" }
        ],
        price: [{ required: true, message: "请输入商品单价", trigger: "blur" }],
        discount: [{ required: true, message: "请输入贡献值", trigger: "blur" }],
        ljfcount: [{ required: true, message: "请输入提货返利积分", trigger: "blur" }],
        bannerpicurl: [
          { required: true, message: "请上传商品图片", trigger: "blur" }
        ],
        content: [
          { required: true, message: "请输入商品描述", trigger: "blur" }
        ],
        state: [{ required: true, message: "请选择商品状态", trigger: "blur" }],
        stock: [{ required: true, message: "请设置商品库存", trigger: "blur" }],
        sid: [{ required: true, message: "请选择店铺", trigger: "blur" }],
        sendext: [{ required: true, message: "请输入偏远地区及运费", trigger: "blur" }],
        card2Count: [{ required: true, message: "请输入获得次卡数量", trigger: "blur" }],
        uLevel: [{ required: true, message: "请选择用户等级", trigger: "blur" }],
        card1Count: [{ required: true, message: "请输入获得体验券数量", trigger: "blur" }]
      },
      tidArr: [], // 分类
      cascaderProps: {
        value: "id",
        label: "tname",
        checkStrictly: true
      },
      userInfo: {},

      // 上传图片相关
      picurlsArr: [], // 已有图片列表
      uploadImageList: [], // 上传成功后的图片列表

      // 店铺
      shopList: [], // 店铺列表
      shopKey: '',
      shopLoading: false,

      modalStatus: 0, // 打开组件弹窗参数  1 商品详情
      currentInfo: {}, // 当前实体信息

      screenHeight: 0,

      proCityList: proCityList,
      areaprops: {
        label: 'name',
        value: 'name'
      }
    };
  },
  computed: {},
  watch: {
    PageIndex(val) {
      this.getData();
    },
    modalStatus() {
      this.getData();
    }
  },
  async mounted() {
    this.listLoading = true;
    await this.getPid();
    await this.init();
    this.GetEnum();
    this.GetCoin();
    this.getInfo();
    // 获取店铺列表
    // this.getShopList();
    this.listLoading = false;
    this.getScreenHeight();
    window.addEventListener('resize', this.getScreenHeight); // 监听窗口大小变化
    console.log('地区：', this.proCityList);
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.getScreenHeight); // 组件销毁前移除监听器  
  },
  methods: {
    /**列表初始化加载 */
    init() {
      this.PageIndex = 1;
      this.getData();
    },
    getScreenHeight() {
      this.screenHeight = window.innerHeight;
    },
    /**表单参数初始化 */
    setForm() {
      this.form = {
        id: 0,
        goodsname: "", // 商品名称
        sketch: "", // 商品简述
        price: "",
        costprice: "0", // 成本价
        discount: 0, // 贡献值
        ljfcount: 0, // 提货返利积分
        giveqz: 0, // 收益值
        qzrate: 0, // 收益倍率
        marketprice: "0", // 市场价
        state: 1,
        sort: 0,
        stock: "",
        istop: "",
        content: "",
        bannerpicurl: "",
        containattr: 0,
        wards: 1, // 所属分区
        tid1: "", // 一级分类
        tid2: "", // 二级分类
        yf: 0, // 运费
        dualyf: '0', // 多商品运费是否叠加
        ishot: '0', // 热卖
        isnew: '0', // 新品
        sid: 1, // 店铺id
        selleruserid: 0, // 商户用户id
        feecoinid: 2, // 消耗币种
        feejf: 0, // 消耗数量
        sendext: 0, // 偏远地区不发货
        card1Count: 0, // 
        card2Count: 0, // 
        startaddress: '', // 
        uLevel: 0, // 
        sendTotal: 1, // 
      };
      this.tidArr = [];
    },
    // 打开设置运费模板
    openExtaddr() {
      this.modalStatus = 1;
    },
    handleChange() {

    },
    /////////////////////////////////////////////////// 弹窗 ////////////////////////////////////////////////////

    /////////////////////// 主对话框  ///////////////////////
    /**
     * 对话框打开前
     * @param {*} form_id 表单id
     */
    openDialog(form_id) {
      // 滚动条移动到表单顶部
      this.$nextTick(() => {
        document.getElementById(form_id).scrollTop = 0;
      });
    },
    /**
     * 新增/编辑按钮点击
     * @param {*} type 1：新增；2：编辑
     * @param {*} item 操作数据对象
     */
    async onVisible(type, item = {}) {
      this.visibleType = type;

      this.setForm();
      this.picurlsArr = [];

      // 编辑商品
      if (type === 2) {

        const { data } = await GoodsFirst({
          id: item.id
        });
        this.form = { ...data };
        // 图片列表
        if (this.form.bannerpicurl) {
          const a = this.form.bannerpicurl.split(" ");
          a.forEach(item => {
            this.picurlsArr.push(item);
          });
        }

        this.tidArr = [];
        this.tidArr.push(this.form.tid1 || 1);
        if (this.form.tid2 != 0) {
          this.tidArr.push(this.form.tid2);
        }
        // this.tidArr = [this.form.tid1 || 1, this.form.tid2];

        if (this.form.startaddress) {
          this.form.startaddress = this.form.startaddress.split(',');
        }
      }

      // 获取店铺列表
      // this.getShopList();

      this.dialogVisible = true;
    },
    /**
     * 选择店铺
     * @param {*} e 目前的选中值
     */
    selectChange(e) {
      this.form.sid = e;
      if (e == -1) {
        this.form.sid = '';
      }
      this.shopList.forEach(item => {
        if (item.id == e) {
          this.form.selleruserid = item.userid;
        }
      });
    },
    // 关闭前
    handleClose() {
      this.setForm();
      // 清空上传组件图片列表
      this.uploadImageList = [];

      this.$refs.forms.resetFields();
      this.$refs.forms.clearValidate();
    },
    /**普通分区 消费积分 \收益值 */
    priceChange(e) {
      if (this.userInfo.roid == 4) {
        // 提货返利积分
        this.form.ljfcount = this.form.price - this.form.costprice;
      } else {
        // 提货返利积分
        this.form.ljfcount = 0;
      }
    },
    /////////////////////////////////////////////////// 图片相关 ////////////////////////////////////////////////
    /**
     * logo上传成功监听
     * @param {*} arr 上传组件成功后的数据列表
     */
    uploadSuccess(arr) {
      // console.log('logo上传成功：', arr)
      this.uploadImageList = arr;
    },
    /**
     * 删除已有logo图片监听
     * @param {*} arr 删除已有图片后的图片列表
     */
    delExistChange(arr) {
      this.picurlsArr = arr;
      // console.log('删除本地图片后：', this.picurlsArr);
    },
    /////////////////////////////////////////////////// 数据请求 ////////////////////////////////////////////////
    /**获取主列表 */
    async getData() {
      this.tableData = [];
      this.listLoading = true;
      const { list, totalCount } = await getgoodspage({
        key: this.key,
        tid: this.tid,
        state: this.state,
        wards: this.wards,
        selleruserid: this.selleruserid || 0,
        PageIndex: this.PageIndex,
        PageSize: this.PageSize
      });
      this.totalCount = totalCount;
      list.forEach(element => {
        // element.tidArr = [element.tid1 || 1, element.tid2];
        element.tidArr = [];
        element.tidArr.push(element.tid1 || 1);
        if (element.tid2 != 0) {
          element.tidArr.push(element.tid2);
        }
        this.tableData.push(element);
      });
      this.listLoading = false;
    },
    /**确定提交（新增/编辑） */
    onEdit() {

      // 图片序列化
      const imgarr = [];
      // 本地图片
      if (this.picurlsArr.length > 0) {
        this.picurlsArr.forEach(item => {
          imgarr.push(item)
        })
      }
      // 新上传图片
      if (this.uploadImageList.length > 0) {
        this.uploadImageList.forEach(item => {
          imgarr.push(item.url)
        })
      }
      this.form.bannerpicurl = imgarr.toString();

      // 如果选择默认店铺
      if (this.form.selleruserid == 0) {
        this.shopList.forEach(item => {
          if (item.id == this.form.sid) {
            this.form.selleruserid = item.userid;
          }
        });
      }

      this.$refs["forms"].validate(async valid => {
        if (valid) {

          this.form.tid2 = Number(this.tidArr[1]) || 0;
          this.form.tid1 = Number(this.tidArr[0]) || 0;
          this.form.istop = Number(this.form.istop) || 0;
          this.form.price = Number(this.form.price) || 0;
          this.form.containattr = Number(this.form.containattr) || 0;
          this.form.marketprice = Number(this.form.marketprice) || 0;
          this.form.costprice = Number(this.form.costprice) || 0;
          this.form.stock = Number(this.form.stock) || 0;
          this.form.sid = Number(this.form.sid) || 1; // 店铺id
          this.form.discount = Number(this.form.discount) || 0;
          this.form.ljfcount = Number(this.form.ljfcount) || 0;
          this.form.yf = Number(this.form.yf) || 0;
          this.form.dualyf = this.form.dualyf || '0';
          this.form.giveqz = Number(this.form.giveqz) || 0;
          this.form.qzrate = Number(this.form.qzrate) || 0;
          this.form.feecoinid = Number(this.form.feecoinid) || 0;

          if (this.form.startaddress) {
            this.form.startaddress = this.form.startaddress.join(' ');
          }


          if (this.form.price < 0) {
            this.$message({
              message: "零售价不能小于成本价",
              type: "error"
            });
            return;
          }

          this.buttonLoading = true;

          const { success, msg } = await GoodsEdti(this.form);
          this.buttonLoading = false;
          if (success) {
            this.dialogVisible = false;
            this.getData();
          }
          this.$message({
            message: msg,
            type: success ? "success" : "error"
          });
        } else {
          this.buttonLoading = false;
          return false;
        }
      });
    },
    /**修改商品状态 */
    async SetValid(val, id) {
      const { success, msg } = await SetState({
        gid: id,
        state: val
      });
      if (success) {
        this.init();
      }
      this.$message({
        message: msg,
        type: success ? "success" : "error"
      });
    },
    /**获取分类 */
    async getPid() {
      const { list } = await getgoodstypepage({
        PageIndex: "1",
        state: '1', // 启用
        PageSize: "10000"
      });
      this.tidList = this.group(list, 0);
    },
    /**分类筛选 */
    group(arr, parentId, isChild = 1) {
      const tree = [];
      arr.map(item => {
        if (isChild === 1) {
          if (item.pid === parentId) {
            if (this.group(arr, item.id, isChild + 1).length > 0) {
              item.children = this.group(arr, item.id, isChild + 1);
            }
            tree.push(item);
          }
        }
        if (isChild === 2) {
          if (item.pid === parentId) {
            if (this.group(arr, item.id, isChild + 1).length > 0) {
              item.children = this.group(arr, item.id, isChild + 1);
            }
            tree.push(item);
          }
        }
      });
      return tree;
    },
    /**获取店铺列表 */
    async getShopList(val) {
      this.shopLoading = true;
      const { list, totalCount, success, msg } = await MallShopPage({
        key: val || '',
        PageIndex: 1,
        PageSize: 100
      })
      this.shopLoading = false;
      this.shopList = list
      // console.log('店铺列表，', list)
    },
    // 获取枚举
    async GetEnum() {
      const res = await GetEnum();
      this.wardsList = res.data['Wards'];
      this.stateList = res.data['GoodsState'];
      this.uLevel = res.data['uLevel'];
    },
    // 获取币种
    async GetCoin() {
      const res = await coinlist();
      this.coinList = res;
    },
    /**获取用户信息 */
    async getInfo() {
      const info = await getInfo()
      this.userInfo = info;
    },
    /**获取偏远地区默认模板 */
    async getExtaddr() {
      const { success, msg, data } = await extaddrItem();
      this.form.extfee = data;
    },
    getRowKey(row) {
      return row.id;
    },

  }
};
</script>

<style lang="scss" scoped></style>
<style lang="scss">
.el-table .warning-row {
  background: oldlace;
}

.demo-table-expand {
  font-size: 0;
}

.demo-table-expand label {
  color: #99a9bf;
}

.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
  padding: 4px 0px;
}
</style>
